package com.shinewind.home.controller;

import cn.hutool.core.util.BooleanUtil;
import com.shinewind.common.constant.messageConstant;
import com.shinewind.home.service.IStatusService;
import com.shinewind.pojo.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/index")
@Api(value = "模型状态接口", description = "用于实现模型状态操作")
public class StatusController {
    @Autowired
    private IStatusService iStatusService;

    @GetMapping("/model/status/{mId}")
    @ApiOperation(value = "按模型id查询单个模型状态信息", notes = "按id查询", response = Result.class)
    public Result getStatusInfoById(@PathVariable("mId") String mId){
        List<String> saleTimeList = iStatusService.getStatusInfoById(mId);
        return Result.success(saleTimeList, BooleanUtil.isTrue(saleTimeList.size() > 0),
                messageConstant.QUERY_SUCCESS);
    }
}